Visual Basic and VBA


personal.xlsb

turn off compile warning when leaving a line

comment an entire block of code


PERSONAL.XLSB INFORMATION 

https://support.microsoft.com/en-us/office/create-and-save-all-your-macros-in-a-single-workbook-66c97ab3-11c2-44db-b021-ae005a9bc790
'D:\Users\rbambauer\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB

 


' TURN OFF THE COMPILE ERROR WARNING WHEN LEAVING A LINE OF CODE


'https://stackoverflow.com/questions/11560934/when-editing-microsoft-office-vba-how-can-i-disable-the-popup-compile-error-m
'Click the menu "Tools" and then "Options".
'In the Options' "Editor" tab, uncheck the "Auto Syntax Check" box. (See screenshot, below.)
'This change does not make the editor stop compiling in the background and marking syntax errors in red (or whatever formatting is specified in the Options tab "Editor Format").
'MS Office programs share this common VBA editor, so if you change an option while editing VBA for Excel then you've changed it for Outlook, Word, etc.

 


'COMMENT AN ENTIRE BLOCK


https://stackoverflow.com/questions/12933279/how-to-comment-and-uncomment-blocks-of-code-in-the-office-vba-editor

In the VBA editor, go to View, Toolbars, Customise... or right click on the tool bar and select Customise... Under the Commands tab, select the Edit menu on the left. Then approximately two thirds of the way down there's two icons, Comment Block and Uncomment Block. Drag and drop these onto your toolbar and then you have easy access to highlight a block of code, and comment it out and uncomment with the click of a button.

button with hotkeys:

  1. Right-click on the toolbar and select Customize...
  2. Select the Commands tab.
  3. Under Categories click on Edit, then select Comment Block in the Commands listbox.
  4. Drag the Comment Block entry onto the Menu Bar (yep! the menu bar)
    Note: You should now see a new icon on the menu bar.
  5. Make sure that the new icon is highlighted (it will have a black square around it) then
    click Modify Selection button on the Customize dialog box.
  6. An interesting menu will popup.
    Under name, add an ampersand (&) to the beginning of the entry.
    So now instead of "Comment Block" it should read &Comment Block.
    Press Enter to save the change.
  7. Click on Modify Selection again and select Image and Text.
  8. Dismiss the Customize dialog box.
  9. Highlight any block of code and press Alt-C. Voila.
  10. Do the same thing for the Uncomment Block or
    any other commands that you find yourself using often.

 


 

 

last updated:    Fri 2021-10-15 7:17 AM